<template>
	<view class="store-info-wrapper">
		<rich-text :nodes="storeInfo" :preview="true"></rich-text>
	</view>
</template>

<script lang="ts">
import { defineComponent, reactive, toRefs } from 'vue'
import { onLoad } from '@dcloudio/uni-app'
import { getStoreInfo } from '@/http/api' 

import NoData from '@/components/NoData.vue'
import GoodsItem from '@/components/GoodsItem.vue'
import Tabs from '@/components/Tabs.vue' 
 
export default defineComponent({
	components:{
		GoodsItem, Tabs, NoData
	},
	setup() { 
		const state = reactive({
			storeInfo: '', 
		}) 
		onLoad((e) => {
			getStoreInfoData(e!.id) 
		}) 
		
		const getStoreInfoData = async (id: number) => {
			let res = await getStoreInfo(id)
				console.log(res);
				if(res.code === 0) { 
					state.storeInfo = res.data?.detailContext.replace('<img ', '<img style="width: 100%;height: auto" ')
				}
		}
		 
		return {    
			...toRefs(state)
		}
	}
})

</script>

<style>page{ background: #f8f8fa; }</style>

<style lang="scss" scoped>
.store-info-wrapper{
	 margin: 24rpx;
}
</style>